package alist

type IOReader struct {
	dataChan chan []byte
}

func NewIOReader(size int) *IOReader {
	return &IOReader{
		dataChan: make(chan []byte, size),
	}
}

func (I *IOReader) Write(p []byte) (n int, err error) {
	I.dataChan <- p
	return len(p), nil
}

func (I *IOReader) Chan() chan []byte {
	return I.dataChan
}
